import {USER_INFO,WX_USER_INFO} from './mutations-type'
import {getStore} from './../config/global'
import {getUserInfo} from './../service/api/index'

export default {
    // 1. 同步用户信息
    syncUserInfo({commit}, userInfo) {
        commit(USER_INFO, {userInfo})
    },
    async reqUserInfo({commit}){
        // 2.1 从本地获取数据
        let userInfo = JSON.parse(getStore('userInfo'));
        if(userInfo){
            commit(USER_INFO, {userInfo});
        }
    },
    syncWXUserInfo({commit}, wxInfo) {
        commit(WX_USER_INFO, {wxInfo})
    },
}